import {useState,createContext} from 'react'
import One from './one'
//创建全局对象
let myContext = createContext("");

function Parent(){

    let[msg,setMsg]= useState("父组件的值");
    let[num,setNum] = useState(100)
     return(
         <myContext.Provider value={{msg,num}}>
         <div>
             <h1>父组件</h1>
             <button onClick={()=>{
                 setNum(num+1);
             }}>+1</button>
             <One></One>
         </div>
         </myContext.Provider>

     )

}

export {Parent,myContext}